package cn.virens.web.components.mybatis;

import javax.sql.DataSource;

import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

/**
 * SqlSessiong工厂构造器
 * 
 * @author virens
 */
public class VirSqlSessionFactoryBuilder extends SqlSessionFactoryBuilder {
	private DataSource writeDataSource;
	private DataSource readDataSource;

	public DataSource getWriteDataSource() {
		return writeDataSource;
	}

	public void setWriteDataSource(DataSource writeDataSource) {
		this.writeDataSource = writeDataSource;
	}

	public DataSource getReadDataSource() {
		return readDataSource;
	}

	public void setReadDataSource(DataSource readdataSource) {
		this.readDataSource = readdataSource;
	}

	@Override
	public SqlSessionFactory build(Configuration config) {
		return new VirSqlSessionFactory(config, this);
	}
}
